﻿using System.Collections.Generic;
using UnityEngine.EventSystems;

namespace LitTools
{
    /// <summary>
    /// 首选过滤器
    /// 仅前x个结果通过
    /// </summary>
    public class FirstNumFilter : IRaycastResultFilter
    {
        public int numCount;
        public List<RaycastResult> FiltRaycastResults(List<RaycastResult> result)
        {
            List<RaycastResult> targets = new List<RaycastResult>();
            int count = result.Count < numCount ? result.Count : numCount;
            for (int i = 0; i < count; i++)
            {
                targets.Add(result[i]);
            }
            return targets;
        }
    }
}